package com.example.mqtt.mica.mqtt.producer;

import net.dreamlu.iot.mqtt.codec.MqttQoS;
import net.dreamlu.iot.mqtt.spring.client.MqttClientTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.nio.charset.StandardCharsets;

/**
 * @author ghl
 * @date 2023/11/16 11:58
 * @note
 */
@Service
public class MqttProducer {

    private static final Logger logger = LoggerFactory.getLogger(MqttProducer.class);
    @Autowired
    private MqttClientTemplate client;

    public boolean publish(String topic, byte[] payload, MqttQoS qos) {
        client.publish(topic, payload, qos);
        return true;
    }

}
